export interface ListModel<T> {
  list: T[]
  page: number
  totalCount: number
  loading?: boolean
  finished?: boolean
}

// 电子游戏的类型，目前只有两个，后端说先写死
export enum ELECTRON_GAME_TYPE {
  PG = 'PG',
  BoleBit = 'BoleBit',
}

// 游戏类型
export enum GAME_TYPE {
  lottery = 'lottery', // 彩票
  sport = 'sport', // 体育
  live = 'live', // 真人
  electro = 'electro', // 电子
  chess = 'chess', // 棋牌
  fish = 'fish', // 捕鱼
}

export enum CATCH_KEYS {
  'markRefresh' = 'markRefresh',
}

// banner请求
export interface GetBannerParamsModel {
  position:
    | 'home_banner'
    | 'promotion_banner'
    | 'vip_banner'
    | 'person_banner'
    | 'rabate_banner'
    | 'casino_banner'
    | 'hot_banner'
    | 'promotion_adv_banner'
    | 'style_display_banner'
    | 'live_casino_banner'
    | 'live_game_banner'
    | 'main_sports_banner'
}

// banner列表
export interface GetBannerItemModel {
  id: number
  name: string
  position: string
  link_type: number
  link: GetBannerItemModel
  image: string
  content: null
  sort: number
  status: number
  create_time: number
  update_time: number
  h5_image: string
  icon: null
  en_name: string
}

/**
 * 游戏字段
 */
export interface GameItemModel {
  id: number
  game_platform_id: number
  game_company_id: number
  game_company_code: string
  code: string
  h5_code: string
  type: number
  cate_type: number
  name: string
  name_cn: null
  image: string
  sort: number
  is_hot: number
  hot_sort: number
  is_maintain: number
  game_platform_name: string
  is_collect: number
}

/**
 * 游戏列表请求参数
 */
export interface GetGameListParamsModel {
  page?: Number
  limit?: Number
  name?: string
  type?: Number //	游戏类型ID
  is_hot?: Number // 是否热门：0=否，1=是
  is_new?: Number // 是否最新：0=否，1=是
  is_recommend?: Number // 是否推荐：0=否，1=是
  code?: string // 厂商id
}

// 游戏列表返回数据
export interface GetGameListDataModel {
  list: GameItemModel[]
  page: number
  totalCount: number
}

export interface OutGameParams {
  game_id: string | number
}

export interface LoginGameParams {
  game_id: Number // 游戏id
  game_company_code?: string
  home_url?: string
  platform?: 'h5'
}

export interface LoginChessGameParams {
  company_code: string
}

// 游戏页面查询参数
export interface PlayPageQuery {
  id: string | number // 游戏id
  type: GAME_TYPE // 游戏类型
  from?: string // 返回路径
}

// 彩票游戏页面参数
export interface PlayLotteryPageQuery extends PlayPageQuery {
  game_company_code: string
  code: string // 游戏code
}

// 彩票通信
export enum IFRAME_POST_MESSAGE_TO_LOTTERY_TYPE {
  major = 'major',
  chat = 'chat',
}

// 彩票通信key
export enum ON_LOTTERY_POST_MESSAGE_TYPE {
  login = 'login',
  focus = 'focus',
  blur = 'blur',
  ChangeLottryGame = 'ChangeLottryGame',
  ExitLottery = 'ExitLottery',
}

export interface LoginOutModel {
  code: number
  message: string
  sign: string
  success: boolean
  data: { success: boolean; transaction_id: string }
}
